package com.Work.auth.controller;

import com.Work.auth.service.SysDeptService;
import com.Work.common.result.Result;
import com.Work.model.system.SysDept;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "部门管理接口")
@RestController
@RequestMapping("/admin/system/sysDept")
public class SysDeptController {

    @Autowired
    private SysDeptService sysDeptService;

    @ApiOperation("查询所有部门并构建树结构")
    @GetMapping("findDeptTree")
    public Result findDeptTree() {
        List<SysDept> deptTree = sysDeptService.findDeptTree();
        return Result.ok(deptTree);
    }
}